From: Kentaro Hayashi Date: Fri, 5 Sep 2025 11:08:19 +0000 (+0900) Subject: Support to build Python module without pkg-config X-Git-Tag: archive/raspbian/0.2.1-2+rpi1^2~1 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/%22stanciumarius94%40gmail.com//%22mailto:i18n-csb%40linuxcsb.org/%22/%22http:/www.example.com/%22stanciumarius94%40gmail.com/%22mailto:i18n-csb%40linuxcsb.org/%22?a=commitdiff_plain;h=2321470c49516ded0127f5dd204e405fc4df1840;p=sentencepiece.git Support to build Python module without pkg-config Gbp-Pq: Name support-python-module-in-place.patch --- diff --git a/python/setup.py b/python/setup.py index da68e71..84f5e92 100755 --- a/python/setup.py +++ b/python/setup.py @@ -85,15 +85,21 @@ class build_ext(_build_ext): """Override build_extension to run cmake.""" def build_extension(self, ext): - cflags, libs = get_cflags_and_libs('../build/root') - - if len(libs) == 0: - if is_sentencepiece_installed(): - cflags = cflags + run_pkg_config('cflags') - libs = run_pkg_config('libs') - else: - subprocess.check_call(['./build_bundled.sh', __version__]) - cflags, libs = get_cflags_and_libs('./build/root') + # cflags, libs = get_cflags_and_libs('../build/root') + # if len(libs) == 0: + # cflags, libs = get_cflags_and_libs('./bundled/root') + + # if len(libs) == 0: + # if is_sentencepiece_installed(): + # cflags = cflags + run_pkg_config('cflags') + # libs = run_pkg_config('libs') + # else: + # subprocess.check_call(['./build_bundled.sh', __version__]) + # cflags, libs = get_cflags_and_libs('./bundled/root') + cflags = ['-I../src'] + cmd = "dpkg-architecture -q DEB_BUILD_GNU_TYPE" + arch = subprocess.check_output(cmd, shell=True).decode("utf-8").strip().split()[0] + libs = ["-L../obj-%s/src" % arch, "-lsentencepiece", "-lsentencepiece_train"] # Fix compile on some versions of Mac OSX # See: https://github.com/neulab/xnmt/issues/199